import {  Edit } from '@element-plus/icons-vue'
import {
  COLUMN_TYPE_OPTIONS,
} from './button-table-constant'
import { IconSelector } from '@/components/vf-icons';
import eventBus from '@/utils/event-bus';
// 空内容
export const emptyText = ''

/**
 * 配置按钮组类型
 *
 * @param {Object} param 参数配置
 * @returns {String|Object} 字符串或输入框
 */
export const edit_select_type = ({ row, column }) => {
    return [
      <vxe-select
        size='default'
        v-model={row[column.field]}
        transfer={true}
        clearable={true}
        placeholder='请选择'
        popup-class-name='designer-select-fixed'
      >
        {COLUMN_TYPE_OPTIONS.map(item => {
          return [<vxe-option key={item.value} label={item.label} value={item.value} />];
        })}
      </vxe-select>,
    ];
};

/**
 * 配置按钮组icon
 *
 * @param {Object} param 参数配置
 * @returns {String|Object} 字符串或输入框
 */
export const edit_select_icon = ({ row, column }) => {
  return [
    <IconSelector 
      placeholder="请输入菜单图标"
      clearable={true}
      v-model={row[column.field]} />
  ];
};
/**
 * 开关插槽
 * @param {Object} param 参数配置
 * @returns {String|Object} 字符串或输入框
 */
export const edit_custom_switch = ({ row, column }) => {
    let disabled = false
   if(row[column.field]){
    eventBus.$emit('defaultValue', row);
   }
   
    return [
      <el-switch
        v-model={row[column.field]}
        disabled={disabled}
        inline-prompt
        active-text='是'
        inactive-text='否'
        size='default'
      />,
    ];
};

export const edit_visibleFunc_icon= ({ row, column }) => {
  return [
    <el-icon style="cursor: pointer;" size="16" onClick={()=>{
      return eventBus.$emit('visibleFunc', {row, column});
    }}>
    <Edit />
  </el-icon>,
  ];
};